import http from "./request.ts"
// /mall-admin/product/list 查询商品
export const queryProductList = (params: { pageNum: number, pageSize: number }): RES<MyQueryProductListModel> => http.get("/product/list", { params })

// 商品列表
export const productList = (params: IProdParams): RES<IProductModel> => http.get('/product/list', { params })

//商品分类 
export const productWithChild = (): RES<any> => http.get('/productCategory/list/withChildren')

//批量设置新品
export const productNewStatus = (ids: number[], newStatus: number): RES<number> => http.post(`/product/update/newStatus?ids=${ids}&newStatus=${newStatus}`)

//批量设置上下架
export const productPublishStatus = (ids: number[], publishStatus: number): RES<number> => http.post(`/product/update/publishStatus?ids=${ids}&publishStatus=${publishStatus}`)

//批量设置推荐商品
export const productRecommendStatus = (ids: number[], recommendStatus: number): RES<number> => http.post(`/product/update/recommendStatus?ids=${ids}&recommendStatus=${recommendStatus}`)

//批量删除商品 /product/update/deleteStatus
export const productDeleteStatus = (ids: number[], deleteStatus: number): RES<number> => http.post(`/product/update/deleteStatus?ids=${ids}&deleteStatus=${deleteStatus}`)

//根据id获取SKU库存信息 /sku/{pid}
export const productSkuId = (pid: number, keyword: string): RES<any> => http.get(`/sku/${pid}?keyword=${keyword}`)

// /mall-admin/product/simpleList 根据商品名称或货号模糊查询
export const getProductSimpleList = (keyword: string): RES<IProductSimpleListModel[]> => http.get(`/product/simpleList?keyword=${keyword}`)
